<html>
<head>
    <script src="../resources/cross-frame-access.js"></script>
    <script>
        window.onload = function()
        {
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.dumpChildFrames();
                testRunner.setDumpConsoleMessages(false);
                testRunner.waitUntilDone();
                testRunner.setPopupBlockingEnabled(false);
            }
            window.frames[0].postMessage('run test', '*');
        }

        window.addEventListener('message', doneTest);
        function doneTest() {
            // The cross-site iframe tried to navigate our same-site iframe
            // "toNavigate" but should have failed. The results dump should
            // include the original content of "toNavigate". We end the test
            // here after a round trip through the task runner so that we don't
            // race with the iframe's attempt to navigate. The test will end when
            // all loading is complete, so if a navigation was started, we should
            // see it.
            if (window.testRunner)
                window.setTimeout(()=>testRunner.notifyDone(), 0);
        }
    </script>
</head>
<body>
<pre id='console'></pre>
<iframe src="http://localhost:8000/security/frameNavigation/resources/frame-with-link-to-navigate.html"></iframe>
<iframe name="toNavigate" src="http://127.0.0.1:8000/security/resources/cross-frame-iframe.html"></iframe>
</body>
</html>
